package com.lib.framework.widget

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter

/**
 * 简单的 FragmentPagerAdapter
 *
 * @author keanbin
 */
open class SimpleFragmentPagerAdapter(fm: FragmentManager) : FragmentPagerAdapter(fm) {


    private var mFragmentManager = fm

    private lateinit var mFragmentList: MutableList<Fragment>

    fun setFragmentList(fragmentList: MutableList<Fragment>) {
        mFragmentList = fragmentList
        notifyDataSetChanged()
    }

    override fun getItem(position: Int): Fragment {
        return mFragmentList[position]
    }

    override fun getCount(): Int {
        return mFragmentList.size ?: 0
    }
}